/*   1:    */ package org.intellij.plugins.relaxNG.model.annotation;
/*   2:    */ 
/*   3:    */

import com.intellij.codeInsight.navigation.NavigationUtil;
import com.intellij.icons.AllIcons.Gutter;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.editor.markup.GutterIconRenderer;
import com.intellij.pom.Navigatable;
import com.intellij.psi.PsiElement;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.Function;
import com.intellij.util.OpenSourceUtil;
import com.intellij.util.containers.ContainerUtil;
import org.intellij.plugins.relaxNG.model.Define;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.event.MouseEvent;
import java.util.Collection;
import java.util.Set;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */
/*  10:    */
/*  11:    */
/*  12:    */
/*  13:    */
/*  14:    */
/*  15:    */
/*  16:    */
/*  17:    */
/*  18:    */
/*  19:    */
/*  20:    */
/*  21:    */
/*  22:    */
/*  23:    */ 
/*  24:    */ class OverridingDefineRenderer
/*  25:    */   extends GutterIconRenderer
/*  26:    */ {
/*  27:    */   private final Set<Define> a;
/*  28:    */   private final String b;
/*  29:    */   
/*  30:    */   public OverridingDefineRenderer(String paramString, Set<Define> paramSet)
/*  31:    */   {
/*  32: 45 */     this.a = paramSet;
/*  33: 46 */     this.b = paramString;
/*  34:    */   }
/*  35:    */   
/*  36:    */   @NotNull
/*  37:    */   public Icon getIcon()
/*  38:    */   {
/*  39: 51 */     Icon tmp3_0 = AllIcons.Gutter.OverridingMethod;
/*  40: 51 */     if (tmp3_0 == null) {
/*  41: 51 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/plugins/relaxNG/model/annotation/OverridingDefineRenderer", "getIcon" }));
/*  42:    */     }
/*  43: 51 */     return tmp3_0;
/*  44:    */   }
/*  45:    */   
/*  46:    */   public boolean isNavigateAction()
/*  47:    */   {
/*  48: 55 */     return true;
/*  49:    */   }
/*  50:    */   
/*  51:    */   @Nullable
/*  52:    */   public AnAction getClickAction()
/*  53:    */   {
/*  54: 60 */     return new MyClickAction(null);
/*  55:    */   }
/*  56:    */   
/*  57:    */   @Nullable
/*  58:    */   public String getTooltipText()
/*  59:    */   {
/*  60: 65 */     return this.b;
/*  61:    */   }
/*  62:    */   
/*  63:    */   private class MyClickAction
/*  64:    */     extends AnAction
/*  65:    */   {
/*  66:    */     private MyClickAction() {}
/*  67:    */     
/*  68:    */     public void actionPerformed(AnActionEvent paramAnActionEvent)
/*  69:    */     {
/*  70: 70 */       OverridingDefineRenderer.doClickAction(paramAnActionEvent, OverridingDefineRenderer.this.a, "Go to overridden define");
/*  71:    */     }
/*  72:    */   }
/*  73:    */   
/*  74:    */   static void doClickAction(AnActionEvent paramAnActionEvent, Collection<Define> paramCollection, String paramString)
/*  75:    */   {
/*  76:    */     Object localObject;
/*  77: 75 */     if (paramCollection.size() == 1)
/*  78:    */     {
/*  79: 76 */       localObject = (Navigatable)((Define)paramCollection.iterator().next()).getPsiElement();
/*  80: 77 */       OpenSourceUtil.navigate(true, new Navigatable[] { localObject });
/*  81:    */     }
/*  82:    */     else
/*  83:    */     {
/*  84: 79 */       localObject = (Define[])paramCollection.toArray(new Define[paramCollection.size()]);
/*  85: 80 */       NavigationUtil.getPsiElementPopup((PsiElement[])ContainerUtil.map((Object[])localObject, new Function()
/*  86:    */       {
/*  87:    */         public PsiElement fun(Define paramAnonymousDefine)
/*  88:    */         {
/*  89: 82 */           return paramAnonymousDefine.getPsiElement();
/*  90:    */         }
/*  91: 82 */       }, PsiElement.EMPTY_ARRAY), paramString).show(new RelativePoint((MouseEvent)paramAnActionEvent.getInputEvent()));
/*  92:    */     }
/*  93:    */   }
/*  94:    */   
/*  95:    */   public boolean equals(Object paramObject)
/*  96:    */   {
/*  97: 90 */     if (this == paramObject) {
/*  98: 90 */       return true;
/*  99:    */     }
/* 100: 91 */     if ((paramObject == null) || (getClass() != paramObject.getClass())) {
/* 101: 91 */       return false;
/* 102:    */     }
/* 103: 93 */     OverridingDefineRenderer localOverridingDefineRenderer = (OverridingDefineRenderer)paramObject;
/* 104: 95 */     if (this.b != null ? !this.b.equals(localOverridingDefineRenderer.b) : localOverridingDefineRenderer.b != null) {
/* 105: 95 */       return false;
/* 106:    */     }
/* 107: 96 */     if (this.a != null ? !this.a.equals(localOverridingDefineRenderer.a) : localOverridingDefineRenderer.a != null) {
/* 108: 96 */       return false;
/* 109:    */     }
/* 110: 98 */     return true;
/* 111:    */   }
/* 112:    */   
/* 113:    */   public int hashCode()
/* 114:    */   {
/* 115:103 */     int i = this.a != null ? this.a.hashCode() : 0;
/* 116:104 */     i = 31 * i + (this.b != null ? this.b.hashCode() : 0);
/* 117:105 */     return i;
/* 118:    */   }
/* 119:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.plugins.relaxNG.model.annotation.OverridingDefineRenderer

 * JD-Core Version:    0.7.0.1

 */